﻿using mscook.core.domain;
using mscook.core.repositories;
using mscook.core.utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mscook.core.services
{
    public class MagazineService : IMagazineService
    {
        private IMagazineRepository iMagazineRepository;
        //private ILogger iLogger;
        public MagazineService(IMagazineRepository iMagazineRepository)
        {
            this.iMagazineRepository = iMagazineRepository;
            //this.iLogger = iLogger;
        }

        public IList<Magazine> SelectAll()
        {
            return iMagazineRepository.GetAll();
        }

        public void SaveOrUpdate(Magazine Magazine)
        {
            iMagazineRepository.SaveOrUpdate(Magazine);
        }

        public bool Delete(string id)
        {
            return iMagazineRepository.Delete(id);
        }

        public IList<Magazine> SelectPageList(int start, int limit, out long total)
        {
            return iMagazineRepository.SelectPageList(start, limit, out total);
        }

        public Magazine Get(string id)
        {
            return iMagazineRepository.Get(id);
        }

        public Magazine GetByYearMonth(string year,string month)
        {
            return iMagazineRepository.GetByYearMonth(year,month);
        }
        public IList<Magazine> GetRecent(int start, int limit)
        {
            return iMagazineRepository.GetRecent(start,limit);
        }

        public IList<Magazine> GetOrderByYearMonth(int start, int limit, out long total)
        {
            return iMagazineRepository.GetOrderByYearMonth(start, limit, out total);
        }

        public IList<Magazine> SelectLimitbyIds(IList<string> resourceIds, int start, int limit, out long total)
        {
            return iMagazineRepository.GetLimitByIds(resourceIds, start, limit, out total);
        }

        public IList<Magazine> SelectPageList(int start, int limit, out long total, string title)
        {
            return iMagazineRepository.SelectPageList(start,limit,out total,title);
        }

        public IList<Magazine> SelectPageListByExpressions(int start, int limit, out long total, System.Linq.Expressions.Expression<Func<Magazine, bool>> expression)
        {
            return iMagazineRepository.SelectPageList(start, limit, out total, expression);
        }
    }
}
